Skip to main content

Prompts

Prompts define how an AI agent behaves. In BindAI, prompts are treated as reusable, structured objects instead of raw strings. They can be:
  • stored in Python
  • loaded from YAML
  • reused across agents
  • parameterized with variables
  • composed dynamically

What is a Prompt?

A prompt contains the instructions sent to the language model before generation. The most common prompt is the system prompt, which defines the agent’s behavior. Example:

Prompt Object

BindAI provides a dedicated Prompt object.
Agents automatically use the prompt during execution.

Creating an Agent


Using Instructions

The simplest way to create a prompt is by using the instructions parameter.
Internally, BindAI stores these instructions inside the prompt object.

YAML Prompts

Prompts are commonly stored in YAML.
Loading the agent automatically loads the prompt.
Keeping prompts in YAML makes them easier to maintain and update without changing Python code.

Variables

Prompts often contain dynamic values. Example:
The application replaces variables before execution. Example:

Static vs Dynamic Prompts

Static prompt:
Dynamic prompt:
Dynamic prompts allow the application to inject runtime information.

Prompt Composition

Prompts can be built from multiple sections. Example:
Instead of writing one large prompt, separate responsibilities into logical sections.

Output Instructions

Prompts often define how responses should be formatted. Example:
Or:
These instructions help produce predictable outputs.

Prompt Reuse

A single prompt can be shared across multiple agents.
This keeps behavior consistent throughout a project.

Prompts and Memory

Prompts define behavior. Memory provides context. Together they determine how an agent responds.
Each serves a different purpose.

Prompts and Knowledge

Knowledge retrieval occurs before model generation. Retrieved information becomes additional context, while the prompt continues to define the agent’s role and instructions. The prompt should describe how to use retrieved information, not contain the information itself.

Best Practices

  • Keep prompts focused on one responsibility.
  • Store prompts in YAML when possible.
  • Keep instructions concise.
  • Separate behavior from runtime data.
  • Use variables instead of duplicating prompts.
  • Clearly define the expected output format.
  • Reuse prompts across similar agents.